package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.StrategyDetailComment;
import cn.wolfcode.trip.base.service.IStrategyDetailCommentService;
import cn.wolfcode.trip.base.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/strategyDetailComments")
public class StrategyDetailCommentController {

    @Autowired
    private IStrategyDetailCommentService strategyDetailCommentService;

    /**
     * 保存攻略文章的评论数据
     * @param strategyDetailComment
     * @return
     */
    @PostMapping
    public JsonResult save(StrategyDetailComment strategyDetailComment) {
        JsonResult result = new JsonResult();
        try {
            strategyDetailCommentService.saveOrUpdate(strategyDetailComment);
        } catch (Exception e) {
            e.printStackTrace();
            result.mark(e.getMessage());
        }
        return result;
    }
    @GetMapping("{strategyDetailCommentId}")
    public Integer queryCountByStrategyDetailCommentId(@PathVariable Long strategyDetailCommentId) {

        return strategyDetailCommentService.queryCountByStrategyDetailCommentId(strategyDetailCommentId);
    }


}
